package chapt07.imaging;

import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;

public class ImagingGLEventListener implements GLEventListener
{		
	@Override
	public void reshape(GLAutoDrawable glautodrawable, int x, int y, int w, int h)
	{
		Imaging.changeSize(glautodrawable.getGL().getGL2(), w, h);
	}
	
	@Override
	public void init(GLAutoDrawable glautodrawable)
	{
		int w = glautodrawable.getWidth();
		int h = glautodrawable.getHeight();
		Imaging.setupRC(glautodrawable.getGL().getGL2(), w, h);
	}
	
	@Override
	public void dispose(GLAutoDrawable glautodrawable)
	{
	
	}
	
	@Override
	public void display(GLAutoDrawable glautodrawable)
	{
		int w = glautodrawable.getWidth();
		int h = glautodrawable.getHeight();
		Imaging.renderScene(glautodrawable.getGL().getGL2(), w, h);
	}
}
